
import { Feedback } from '@icedesign/base';
import cookie from 'react-cookies'

const Util = {
    AuthUtil(res, history) {
        if (res.data.code !== 0) {
            Feedback.toast.error(res.data.message),
                history.push('/login');

        }
    },
    UserLogin(name, pass, uniq) {
        return send('/user/index/login', {
            name, pass, uniq
        }, 'POST');
    },

    crtTimeFtt(value, row, index) {
        var crtTime = new Date(value);
        return top.dateFtt("yyyy-MM-dd hh:mm:ss", crtTime);//直接调用公共JS里面的时间类处理的办法     
    },

    authority(history) {

        if (cookie.load('name') === null) {
            Feedback.toast.error("您未登录，或登录过期");
            history.push("/login")
        }

    }
}
export default Util